#ifndef __FILE_H
#define __FILE_H

#include <iostream>
#include <fstream>
#include <string>
#include <sstream>

struct OrderedData
{
    int o;
    double d;
    OrderedData(int order=0, double data=0): o(order),d(data){};
    OrderedData(const OrderedData& od) {o=od.o; d=od.d;};
    //OrderedData& operator=(const OrderedData& od) {o=od.o; d=od.d;return *this;};
};

class FileRW
{
public:
    FileRW() {};
    FileRW(std::string filename) {Add_File(filename);};
    void Add_File(std::string filename);
    bool isOpened();
    void close();
    int File_Clear();
    int Save_Data(double data);
    int Save_Data(const OrderedData& data);
    int Save_Data(int order, double data);
    int Load_Data(int order, double *data);
private:
    OrderedData _od;
    std::string _filename;
    std::fstream *_fp;
};

#endif
